//
//  BiliBiliDynamicHeaderView.m
//  BiliBiliDemo
//
//  Created by IMAC on 16/4/27.
//  Copyright © 2016年 XDH. All rights reserved.
//

#import "BiliBiliDynamicHeaderView.h"

@implementation BiliBiliDynamicHeaderView

//类创建方法
+ (__kindof UIView *)dynamicHeaderView
{
    return [[self alloc]init];
}

//对象创建方法
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        /****** 创建子控件 *****/
        //自身
        self.bounds = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT * 0.2 );
        self.backgroundColor = BACKGROUND_COLOR;
        
        //生成图片控件
        UIImageView *imgView = [[UIImageView alloc]initWithImage:[UIImage FileImageWithContentsOfFileName:@"dynamicheader"]];//创建
        imgView.center = CGPointMake(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.1);//中点
        imgView.bounds = self.bounds;//尺寸
        [self addSubview:imgView];//加入父控件中
        
        //生成文字控件
        UILabel *lbl = [[UILabel alloc]init];
        self.label = lbl;
        lbl.text = @"可以追这些番哦~";
        lbl.font = FONT(14);
        [lbl sizeToFit];
        lbl.center = imgView.center;
        [self addSubview:lbl];
        
        //顶部分割线
        UIView *topView = [[UIView alloc]init];//创建
        topView.frame = CGRectMake(0, 0, self.width, separatorH);//frame
        [self addSubview:topView];//加入父控件中
        topView.backgroundColor = [UIColor grayColor];//背景颜色
        
        //底部分割线
        UIView *buttomView = [[UIView alloc]init];//创建
        buttomView.frame = CGRectMake(0, self.height - separatorH, self.width, separatorH);//frame
        [self addSubview:buttomView];//加入父控件中
        buttomView.backgroundColor = [UIColor grayColor];//背景颜色
    }
    return self;
}

@end
